
<template>
  <div>
    <input type="text" v-model="loginForm.username" placeholder="用户名"/>
    <input type="text" v-model="loginForm.password" placeholder="密码"/>
    <button @click="login">登录</button>
  </div>
</template>



<style>

</style>

<script>
  import {userLogin} from '@/api/login'
  export default {
    name: "PageFour",
    data () {
      return {
        loginForm: {
          username: '',
          password: ''
        }
      };
    },
    methods: {
      login(){
        if (this.loginForm.username === '' || this.loginForm.password === '') {
          alert('账号或密码不能为空');
        } else {
        let data = {

        }
          userLogin(this.loginForm).then(res=>{
            if (res.code == 0) {
              console.log(res)
              this.$notify({
                title: '成功',
                message: res.msg,
                type: 'success'
              });
            }else {

            }


          }).catch(error => {
            alert('账号或密码错误');
            console.log(error);
          });


        }




      }
    }
  };
</script>
